** This code reproduces the results from Study 2 (Table 4)


* ----------------- *
* 	Finnish Sample	*
* ----------------- *


* Opens data
use "$directory/Parallel runs/data/Finland_data.dta", clear

* cleans and renames variables
recode gndr (1 = 0 "male") (2 = 1 "female") (9 =.), gen(female)

rename agea agerespondent

recode edulvlb (9999 5555 .a .b = .), gen(education_lvl)
label values education_lvl edulvlb

recode hincfel (9 .a .b =.), gen(feel_income)
label values feel_income hincfel

recode netusoft (9 = .), gen(netuse)
label values netuse netusoft

recode stfdem (99 .a .b = .), gen(SWD)
lab val SWD stfdem

recode fairelc (99 .a .b = .), gen(fair_election)
lab val fair_election fairelc

recode medcrgv (99 .a .b = .), gen(media_free)
lab val media_free medcrgv

recode rghmgpr (99 .a .b = .), gen(minority_rights)
lab val minority_rights rghmgpr

recode cttresa (99 .a .b = .), gen(impartial_courts)
lab val impartial_courts cttresa

recode implvdm (99 .a .b = .), gen(importance_democracy)
lab val importance_democracy implvdm

recode accalaw (99 .a .b = .), gen(leader_v2)

recode dfprtal (99 .a .b =.), gen(party_alternatives)
lab val party_alternatives dfprtal

recode gptpelc (99 .a .b =.), gen(gov_sanction)
lab val gov_sanction gptpelc


* Step 1: Estimates OLS regression coefficients for Table 4: 
eststo clear
eststo m1: reg SWD i.D i.female c.agerespondent c.agerespondent##c.agerespondent i.education_lvl i.feel_income c.netuse, rob
eststo m2: reg importance_democracy i.D i.female c.agerespondent c.agerespondent##c.agerespondent i.education_lvl i.feel_income c.netuse, rob
eststo m3: reg leader_v2 i.D i.female c.agerespondent c.agerespondent##c.agerespondent i.education_lvl i.feel_income c.netuse, rob
eststo m4: reg fair_election i.D i.female c.agerespondent c.agerespondent##c.agerespondent i.education_lvl i.feel_income c.netuse, rob
eststo m5: reg media_free i.D i.female c.agerespondent c.agerespondent##c.agerespondent i.education_lvl i.feel_income c.netuse, rob
eststo m6: reg minority_rights i.D i.female c.agerespondent c.agerespondent##c.agerespondent i.education_lvl i.feel_income c.netuse, rob
eststo m7: reg impartial_courts i.D i.female c.agerespondent c.agerespondent##c.agerespondent i.education_lvl i.feel_income c.netuse, rob
eststo m8: reg party_alternatives i.D i.female c.agerespondent c.agerespondent##c.agerespondent i.education_lvl i.feel_income c.netuse, rob
eststo m9: reg gov_sanction i.D i.female c.agerespondent c.agerespondent##c.agerespondent i.education_lvl i.feel_income c.netuse, rob

* Step 2: Estimates Romano-Wolf adjusted p-values:
rwolf ///
	SWD fair_election media_free minority_rights impartial_courts importance_democracy leader_v2 party_alternatives gov_sanction ///
	, indepvar(D) ///
	controls(i.female c.agerespondent c.agerespondent##c.agerespondent i.education_lvl c.feel_income c.netuse) ///
	reps(250) method(regress) seed(1111)


*** Note that Table 4 was created manually. Point estimates and standard errors obtained from regressions in Step 1 (for variable "i.selfcompletion"). P-values optained from Step 2. 
	
	
	
* ----------------- *
* 	GB Sample		*
* ----------------- *



* Opens appended data
use "$directory/Parallel runs/data/GB_data.dta", clear

* Cleans and renames variables
recode gndr (1 = 0 "male") (2 = 1 "female") (9 =.), gen(female)

rename agea agerespondent

recode edulvlb (9999 5555 .a .b = .), gen(education_lvl)
label values education_lvl edulvlb

recode hincfel (9 .a .b =.), gen(feel_income)
label values feel_income hincfel

recode netusoft (9 = .), gen(netuse)
label values netuse netusoft

recode stfdem (99 .a .b = .), gen(SWD)
lab val SWD stfdem

recode fairelc (99 .a .b = .), gen(fair_election)
lab val fair_election fairelc

recode medcrgv (99 .a .b = .), gen(media_free)
lab val media_free medcrgv

recode rghmgpr (99 .a .b = .), gen(minority_rights)
lab val minority_rights rghmgpr

recode cttresa (99 .a .b = .), gen(impartial_courts)
lab val impartial_courts cttresa

recode implvdm (99 .a .b = .), gen(importance_democracy)
lab val importance_democracy implvdm

recode accalaw (99 .a .b = .) (10 = 0 "Comp. acceptable") (9=1) (8=2) (7=3) (6=4) (5=5) (4=6) (3=7) (2=8) (1=9) (0=10 "Not at all accept."), gen(strong_leader)
* NB. accalaw/strong_leader coded so that higher values (10) is MORE democratic attitudes (similar to other items.)

recode accalaw (99 .a .b =.), gen(leader_v2)

recode dfprtal (99 .a .b =.), gen(party_alternatives)
lab val party_alternatives dfprtal

recode gptpelc (99 .a .b =.), gen(gov_sanction)
lab val gov_sanction gptpelc

* Step 1: Estimates OLS regression coefficients (for Table 4)
eststo clear
eststo m1: reg SWD i.D i.female c.agerespondent c.agerespondent##c.agerespondent i.education_lvl i.feel_income c.netuse, rob
eststo m2: reg importance_democracy i.D i.female c.agerespondent c.agerespondent##c.agerespondent i.education_lvl i.feel_income c.netuse, rob
eststo m3: reg leader_v2 i.D i.female c.agerespondent c.agerespondent##c.agerespondent i.education_lvl i.feel_income c.netuse, rob
eststo m4: reg fair_election i.D i.female c.agerespondent c.agerespondent##c.agerespondent i.education_lvl i.feel_income c.netuse, rob
eststo m5: reg media_free i.D i.female c.agerespondent c.agerespondent##c.agerespondent i.education_lvl i.feel_income c.netuse, rob
eststo m6: reg minority_rights i.D i.female c.agerespondent c.agerespondent##c.agerespondent i.education_lvl i.feel_income c.netuse, rob
eststo m7: reg impartial_courts i.D i.female c.agerespondent c.agerespondent##c.agerespondent i.education_lvl i.feel_income c.netuse, rob
eststo m8: reg party_alternatives i.D i.female c.agerespondent c.agerespondent##c.agerespondent i.education_lvl i.feel_income c.netuse, rob
eststo m9: reg gov_sanction i.D i.female c.agerespondent c.agerespondent##c.agerespondent i.education_lvl i.feel_income c.netuse, rob

* Step 2: Estimates Romano-Wolf adjusted p-values
rwolf ///
	SWD fair_election media_free minority_rights impartial_courts importance_democracy leader_v2 party_alternatives gov_sanction ///
	, indepvar(D) ///
	controls(i.female c.agerespondent c.agerespondent##c.agerespondent i.education_lvl c.feel_income c.netuse) ///
	reps(250) method(regress) seed(1111)


*** Note that Table 4 was created manually. Point estimates and standard errors obtained from regressions in Step 1 (for variable "i.selfcompletion"). P-values optained from Step 2. 



	